﻿using Template.Service;
using Template.Repository;
using Template.DomainService;

namespace Template.WebApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            #region >> 配置文件
            #endregion

            #region >> BusinessService

            services.AddBusinessService();

            #endregion

            #region >> Repository

            services.AddRepository();

            #endregion

            #region >> DomainService

            services.AddDomainService();

            #endregion

            services.AddMvc();
            services.AddControllers();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
    }
}
